<%--
  Created by IntelliJ IDEA.
  User: 刘邓
  Date: 2023-06-10
  Time: 9:43
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
  <title>设置选课时间</title>
  <link rel="stylesheet" type="text/css" href="/form.css" />
</head>
<body>
<form action="/course/updateTime" class="container">
  <div class="form-group">开始时间:<input type="datetime-local" min="00:00" max="23:59" name="startTime0" id="s_time" class="form-control"></div>
  <div class="form-group">结束时间:<input type="datetime-local" min="00:00" max="23:59" name="endTime0" id="e_time" class="form-control"></div>
  <div style="text-align: center"><input style="width: 100px;height: 50px;background-color: #fff" class="btn btn-primary" type="submit" value="确定" id="toUpdate"></div>
</form>


</body>
<script>
  let toUpdate = document.getElementById("toUpdate");
  toUpdate.addEventListener("click",(evt)=>{
    let stime_str=document.getElementById("s_time").value;
    if(stime_str===null||stime_str===""){
      alert("请选择开始日期");
      evt.preventDefault();
      return;
    }
    let etime_str=document.getElementById("e_time").value;
    if(etime_str===null||etime_str===""){
      alert("请选择结束日期");
      evt.preventDefault();
      return;
    }
  })
</script>
</html>
